package com.cn.webspider;

import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.downloader.HttpClientDownloader;
import us.codecraft.webmagic.processor.PageProcessor;
import us.codecraft.webmagic.scheduler.FileCacheQueueScheduler;
import us.codecraft.webmagic.selector.Html;
import us.codecraft.webmagic.selector.Selectable;

import java.util.List;

public class DoubanSpider implements PageProcessor {
    public Site site = Site.me().setRetryTimes(3).setSleepTime(2000);

    @Override
    public void process(Page page) {
        String url1 = page.getUrl().get();
        if (url1 != null && url1.startsWith("https://movie.douban.com/subject/")) {
            Selectable xpath = page.getHtml().xpath("//div[@id=info]");
            Douban douban = new Douban();
            douban.setDirector(xpath.xpath("//a[@rel=v:directedBy]/text()").get());
            douban.setWriter(xpath.xpath("//text()='编剧:'/a/text()").get());
//            List<String> collect = Arrays.asList(xpath.xpath("//div[@id='info']/text()")
//                    .get()
//                    .trim()
//                    .split("  "))
//                    .stream()
//                    .filter(e -> e != null && e.length() > 2)
//                    .collect(Collectors.toList());
            //获取id
            url1 = url1.substring(0, url1.length() - 1);
            douban.setId(url1.substring(url1.lastIndexOf("/") + 1));
            douban.setType(xpath.xpath("//span[@property=v:genre]/text()").get());
//            if ()
//            douban.setCountry(collect.get(0));
//            douban.setLanguage(collect.get(1));
            //            douban.setNick(collect.get(2));
            douban.setTime(xpath.xpath("//span[@property=v:initialReleaseDate]/text()").get());
            douban.setLength(xpath.xpath("//span[@property=v:runtime]/text()").get());
            douban.setActor(xpath.xpath("//a[@rel=v:starring]/text()").all().toString());

            page.putField("detail", douban);
        } else {
            Subjects doubans = JSON.parseObject(page.getRawText(), Subjects.class);
            page.putField("doubans", doubans);
            doubans.getSubjects().forEach(e -> {
//            https://movie.douban.com/subject/30163509/
                page.addTargetRequest(e.getUrl());
            });
            //这里是截取start=后面的数值，每一次增加20
            String url = page.getUrl().get();
            String count = url.substring(url.lastIndexOf("start=") + 6);
            if (StringUtils.isNotBlank(count)) {
                url = url.substring(0, url.lastIndexOf("start=") + 6) + (Integer.valueOf(count) + 20);
            }
            page.addTargetRequest(url);
        }
    }

    @Override
    public Site getSite() {
        return site;
    }

    @Test
    public void test() {
        HttpClientDownloader httpClientDownloader = new HttpClientDownloader();
//        httpClientDownloader.setProxyProvider(SimpleProxyProvider
//                .from(
////                        new Proxy("93.87.17.1", 53281),
////                        new Proxy("104.41.141.2", 81),
////                        new Proxy("54.39.23.81", 8082),
////                        new Proxy("85.175.226.106", 44812),
//                        new Proxy("111.177.184.157", 9999)));
        Spider.create(new DoubanSpider())
//                .addUrl("https://movie.douban.com/subject/30163509/")
                .addUrl("https://movie.douban.com/j/search_subjects?type=movie&tag=%E7%83%AD%E9%97%A8&sort=recommend&page_limit=20&page_start=0")
                .addPipeline(new SaveDouBan())
                .setDownloader(httpClientDownloader).setScheduler(new FileCacheQueueScheduler("E:\\spiderdouban"))
//                .setScheduler()
                .thread(1)
                .run();
//        String s = "{\"subjects\":[{\"rate\":\"7.0\",\"cover_x\":7142,\"title\":\"飞驰人生\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/30163509\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2542973862.jpg\",\"id\":\"30163509\",\"cover_y\":10000,\"is_new\":false},{\"rate\":\"5.7\",\"cover_x\":1078,\"title\":\"新喜剧之王\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/4840388\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2541240741.jpg\",\"id\":\"4840388\",\"cover_y\":1512,\"is_new\":false},{\"rate\":\"8.8\",\"cover_x\":1449,\"title\":\"续·终物语\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/27615868\\/\",\"playable\":false,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2527221882.jpg\",\"id\":\"27615868\",\"cover_y\":2048,\"is_new\":true},{\"rate\":\"6.6\",\"cover_x\":1241,\"title\":\"非同凡响\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/27663808\\/\",\"playable\":false,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2521633351.jpg\",\"id\":\"27663808\",\"cover_y\":1754,\"is_new\":true},{\"rate\":\"8.7\",\"cover_x\":3300,\"title\":\"小偷家族\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/27622447\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2530599636.jpg\",\"id\":\"27622447\",\"cover_y\":4659,\"is_new\":false},{\"rate\":\"7.3\",\"cover_x\":1153,\"title\":\"密室逃生\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/27109679\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2543631842.jpg\",\"id\":\"27109679\",\"cover_y\":1700,\"is_new\":false},{\"rate\":\"6.4\",\"cover_x\":960,\"title\":\"疯狂的外星人\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/25986662\\/\",\"playable\":false,\"cover\":\"https://img1.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2541901817.jpg\",\"id\":\"25986662\",\"cover_y\":1359,\"is_new\":false},{\"rate\":\"8.7\",\"cover_x\":2200,\"title\":\"蜘蛛侠：平行宇宙\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/26374197\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2542867516.jpg\",\"id\":\"26374197\",\"cover_y\":3123,\"is_new\":false},{\"rate\":\"7.1\",\"cover_x\":1080,\"title\":\"大黄蜂\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/26394152\\/\",\"playable\":true,\"cover\":\"https://img1.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2541662397.jpg\",\"id\":\"26394152\",\"cover_y\":1590,\"is_new\":false},{\"rate\":\"7.9\",\"cover_x\":5315,\"title\":\"白蛇：缘起\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/30331149\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2544313786.jpg\",\"id\":\"30331149\",\"cover_y\":7441,\"is_new\":false},{\"rate\":\"7.7\",\"cover_x\":6750,\"title\":\"海王\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/3878007\\/\",\"playable\":true,\"cover\":\"https://img1.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2541280047.jpg\",\"id\":\"3878007\",\"cover_y\":10000,\"is_new\":false},{\"rate\":\"7.5\",\"cover_x\":2000,\"title\":\"驯龙高手3\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/19899707\\/\",\"playable\":false,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2546335362.jpg\",\"id\":\"19899707\",\"cover_y\":2975,\"is_new\":false},{\"rate\":\"7.2\",\"cover_x\":2050,\"title\":\"毒液：致命守护者\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/3168101\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2537158013.jpg\",\"id\":\"3168101\",\"cover_y\":2910,\"is_new\":false},{\"rate\":\"7.7\",\"cover_x\":1800,\"title\":\"极限职业\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/27597250\\/\",\"playable\":false,\"cover\":\"https://img1.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2542216607.jpg\",\"id\":\"27597250\",\"cover_y\":2565,\"is_new\":false},{\"rate\":\"8.1\",\"cover_x\":1429,\"title\":\"无名之辈\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/27110296\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2539661066.jpg\",\"id\":\"27110296\",\"cover_y\":2000,\"is_new\":false},{\"rate\":\"8.1\",\"cover_x\":1000,\"title\":\"无双\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/26425063\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2535260806.jpg\",\"id\":\"26425063\",\"cover_y\":1400,\"is_new\":false},{\"rate\":\"8.5\",\"cover_x\":1130,\"title\":\"无主之作\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/26701196\\/\",\"playable\":false,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2529384763.jpg\",\"id\":\"26701196\",\"cover_y\":1600,\"is_new\":false},{\"rate\":\"9.0\",\"cover_x\":1080,\"title\":\"我不是药神\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/26752088\\/\",\"playable\":true,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2519070834.jpg\",\"id\":\"26752088\",\"cover_y\":1512,\"is_new\":false},{\"rate\":\"7.6\",\"cover_x\":5000,\"title\":\"阿丽塔：战斗天使\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/1652592\\/\",\"playable\":false,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2544987866.jpg\",\"id\":\"1652592\",\"cover_y\":7413,\"is_new\":false},{\"rate\":\"8.1\",\"cover_x\":1382,\"title\":\"骡子\",\"url\":\"https:\\/\\/movie.douban.com\\/subject\\/30135113\\/\",\"playable\":false,\"cover\":\"https://img3.doubanio.com\\/view\\/photo\\/s_ratio_poster\\/public\\/p2542326692.jpg\",\"id\":\"30135113\",\"cover_y\":2048,\"is_new\":false}]}";
//        Subjects doubans = JSON.parseObject(s, Subjects.class);
//        String url = "https://movie.douban.com/j/search_subjects?type=movie&tag=%E7%83%AD%E9%97%A8&sort=recommend&page_limit=20&page_start=0324442";
//        url.substring(url.lastIndexOf("start=") + 6);
//        url.substring(0, url.lastIndexOf("start=") + 6);
//        Page page = new Page();
//        Html html = new Html("<span><span class=\"pl\">编剧</span>: <span class=\"attrs\"><a href=\"/celebrity/1275307/\">韩寒</a></span></span>");
//        Selectable xpath = html;
//        xpath.xpath("//text()='编剧'/a/text()");
//        String s = "<div id=\"info\"> \n" +
//                " <span><span class=\"pl\">导演</span>: <span class=\"attrs\"><a href=\"/celebrity/1275307/\" rel=\"v:directedBy\">韩寒</a></span></span>\n" +
//                " <br> \n" +
//                " <span><span class=\"pl\">编剧</span>: <span class=\"attrs\"><a href=\"/celebrity/1275307/\">韩寒</a></span></span>\n" +
//                " <br> \n" +
//                " <span class=\"actor\"><span class=\"pl\">主演</span>: <span class=\"attrs\"><a href=\"/celebrity/1325700/\" rel=\"v:starring\">沈腾</a> / <a href=\"/celebrity/1354442/\" rel=\"v:starring\">黄景瑜</a> / <a href=\"/celebrity/1332934/\" rel=\"v:starring\">尹正</a> / <a href=\"/celebrity/1338466/\" rel=\"v:starring\">张本煜</a> / <a href=\"/celebrity/1340310/\" rel=\"v:starring\">尹昉</a> / <a href=\"/celebrity/1316331/\" rel=\"v:starring\">田雨</a> / <a href=\"/celebrity/1355058/\" rel=\"v:starring\">魏翔</a> / <a href=\"/celebrity/1018759/\" rel=\"v:starring\">赵文瑄</a> / <a href=\"/celebrity/1299052/\" rel=\"v:starring\">腾格尔</a> / <a href=\"/celebrity/1317854/\" rel=\"v:starring\">易小星</a> / <a href=\"/celebrity/1408302/\" rel=\"v:starring\">李庆誉</a> / <a href=\"/celebrity/1341199/\" rel=\"v:starring\">高华阳</a> / <a href=\"/celebrity/1337891/\" rel=\"v:starring\">刘帅良</a> / <a href=\"/celebrity/1314149/\" rel=\"v:starring\">李玲玉</a> / <a href=\"/celebrity/1316769/\" rel=\"v:starring\">何穗</a> / <a href=\"/celebrity/1313269/\" rel=\"v:starring\">潘晓婷</a> / <a href=\"/celebrity/1004530/\" rel=\"v:starring\">田沅</a> / <a href=\"/celebrity/1364470/\" rel=\"v:starring\">李春嫒</a> / <a href=\"/celebrity/1275721/\" rel=\"v:starring\">冯绍峰</a></span></span>\n" +
//                " <br> \n" +
//                " <span class=\"pl\">类型:</span> \n" +
//                " <span property=\"v:genre\">喜剧</span>\n" +
//                " <br> \n" +
//                " <span class=\"pl\">制片国家/地区:</span> 中国大陆\n" +
//                " <br> \n" +
//                " <span class=\"pl\">语言:</span> 汉语普通话 / 英语\n" +
//                " <br> \n" +
//                " <span class=\"pl\">上映日期:</span> \n" +
//                " <span property=\"v:initialReleaseDate\" content=\"2019-02-05(中国大陆)\">2019-02-05(中国大陆)</span>\n" +
//                " <br> \n" +
//                " <span class=\"pl\">片长:</span> \n" +
//                " <span property=\"v:runtime\" content=\"98\">98分钟</span>\n" +
//                " <br> \n" +
//                " <span class=\"pl\">又名:</span> Pegasus\n" +
//                " <br> \n" +
//                " <span class=\"pl\">IMDb链接:</span> \n" +
//                " <a href=\"http://www.imdb.com/title/tt9597190\" target=\"_blank\" rel=\"nofollow\">tt9597190</a>\n" +
//                " <br> \n" +
//                "</div>";
//        Html html = new Html(s);
////        html.xpath("//span[contains(@class,'pl')]").get();
//        html.xpath("//span[contains(@class,'pl')]").get();
//        Arrays.asList(html.xpath("//div[@id='info']/text()").get().trim().split("  ")).stream().filter(e -> e != null && e.length() > 0).collect(Collectors.toList());
////        html.xpath("//span[//text()='制片国家/地区:']").get();
//        html.xpath("//span[@property=v:genre] following-sibling span").get();

    }

    public static class Subjects {
        List<Douban> subjects;

        public List<Douban> getSubjects() {
            return subjects;
        }

        public void setSubjects(List<Douban> subjects) {
            this.subjects = subjects;
        }
    }

    public static class Detail {
        public String director;
        public String writer;
        public String actor;
        public String type;
        public String country;
        public String language;
        public String time;
        public String length;
        public String nick;

        public String getDirector() {
            return director;
        }

        public void setDirector(String director) {
            this.director = director;
        }

        public String getWriter() {
            return writer;
        }

        public void setWriter(String writer) {
            this.writer = writer;
        }

        public String getActor() {
            return actor;
        }

        public void setActor(String actor) {
            this.actor = actor;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getCountry() {
            return country;
        }

        public void setCountry(String country) {
            this.country = country;
        }

        public String getLanguage() {
            return language;
        }

        public void setLanguage(String language) {
            this.language = language;
        }

        public String getTime() {
            return time;
        }

        public void setTime(String time) {
            this.time = time;
        }

        public String getLength() {
            return length;
        }

        public void setLength(String length) {
            this.length = length;
        }

        public String getNick() {
            return nick;
        }

        public void setNick(String nick) {
            this.nick = nick;
        }
    }

    public static class Douban extends Detail {
        public String id;
        public String rate;
        public String cover_x;
        public String title;
        public String url;
        public boolean palyable;
        public String cover;
        public String cover_y;
        public boolean is_new;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getRate() {
            return rate;
        }

        public void setRate(String rate) {
            this.rate = rate;
        }

        public String getCover_x() {
            return cover_x;
        }

        public void setCover_x(String cover_x) {
            this.cover_x = cover_x;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public boolean isPalyable() {
            return palyable;
        }

        public void setPalyable(boolean palyable) {
            this.palyable = palyable;
        }

        public String getCover() {
            return cover;
        }

        public void setCover(String cover) {
            this.cover = cover;
        }

        public String getCover_y() {
            return cover_y;
        }

        public void setCover_y(String cover_y) {
            this.cover_y = cover_y;
        }

        public boolean isIs_new() {
            return is_new;
        }

        public void setIs_new(boolean is_new) {
            this.is_new = is_new;
        }
    }

    @Test
    public void te() {
        String s = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
                "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
                " <head> \n" +
                "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"> \n" +
                "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0\"> \n" +
                "  <title>8-被睡走�望的丈夫拜�迫不得已�T惑其他男人在线播放-人妻-35pao视频</title> \n" +
                "  <meta name=\"keywords\" content=\"8-被睡走�望的丈夫拜�迫不得已�T惑其他男人免费在线观看,8-被睡走�望的丈夫拜�迫不得已�T惑其他男人剧情介绍,8-被睡走�望的丈夫拜�迫不得已�T惑其他男人电影海报\"> \n" +
                "  <meta name=\"description\" content=\"8-被睡走�望的丈夫拜�迫不得已�T惑其他男人剧情:\"> \n" +
                "  <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/template/vipwap/images/favicon.ico\"> \n" +
                "  <link href=\"/template/vipwap/images/icon.png\" rel=\"apple-touch-icon\"> \n" +
                "  <link href=\"/template/vipwap/images/icon-72.png\" sizes=\"72x72\" rel=\"apple-touch-icon\"> \n" +
                "  <link href=\"/template/vipwap/images/icon-114.png\" sizes=\"114x114\" rel=\"apple-touch-icon\"> \n" +
                "  <link href=\"/template/vipwap/images/m_av69_tv_style.css?v1\" rel=\"stylesheet\" type=\"text/css\"> \n" +
                "  <script src=\"/template/vipwap/images/jquery.min.js\"></script> \n" +
                "  <script type=\"text/javascript\" src=\"/template/vipwap/images/5alopiujyhg6y5g5ytg5t.js\"></script> \n" +
                " </head> \n" +
                " <body onload=\"setTimeout(function() { window.scrollTo(0, 1); fixedAddScreen(); }, 100);\"> \n" +
                "  <div class=\"content\" style=\"overflow: hidden;\"> \n" +
                "   <div class=\"header\"> \n" +
                "    <a class=\"logo async\" href=\"/\" title=\"35pao视频手机版\"></a> \n" +
                "    <ul class=\"menu\"> \n" +
                "     <li class=\"three\"><a href=\"javascript:void(0);\" title=\"Search\" class=\"menu-item\" rel=\"search-block\"></a></li> \n" +
                "    </ul> \n" +
                "    <a href=\"javascript:void(0)\" style=\"float: right; display: none\" class=\"cancel-button\" rev=\"#\">Cancel</a>\n" +
                "   </div> \n" +
                "   <div class=\"search top-block\" id=\"search-block\"> \n" +
                "    <script type=\"text/javascript\" src=\"/js/sosuo.js\"></script> \n" +
                "   </div> \n" +
                "   <div class=\"buttons2\"> \n" +
                "    <a href=\"/\">首页</a> \n" +
                "    <a href=\"/diao/se27.html\" rel=\"\" class=\"se async\" title=\"All\">乱伦</a> \n" +
                "    <a href=\"/diao/se28.html\" rel=\"\" class=\"se async\" title=\"All\">人妻</a> \n" +
                "    <a href=\"/diao/se29.html\" rel=\"\" class=\"se async\" title=\"All\">偷拍</a> \n" +
                "    <a href=\"/diao/se34.html\" rel=\"\" class=\"se async\" title=\"All\">学生</a> \n" +
                "    <a href=\"/tu/2.html\" rel=\"\" class=\"se async\" title=\"All\">图片</a> \n" +
                "   </div> \n" +
                "   <div class=\"buttons2\"> \n" +
                "    <a href=\"/diao/se54.html\" rel=\"\" class=\"se async\" title=\"All\">巨乳</a> \n" +
                "    <a href=\"/diao/se55.html\" rel=\"\" class=\"se async\" title=\"All\">日韩</a> \n" +
                "    <a href=\"/diao/se56.html\" rel=\"\" class=\"se async\" title=\"All\">欧美</a> \n" +
                "    <a href=\"/diao/se57.html\" rel=\"\" class=\"se async\" title=\"All\">国产</a> \n" +
                "    <a href=\"/diao/se58.html\" rel=\"\" class=\"se async\" title=\"All\">动漫</a> \n" +
                "    <a rel class=\"se async\" title=\"All\" target=\"_blank\" href=\"/tu/1.html\">小说</a> \n" +
                "   </div> \n" +
                "   <script type=\"text/javascript\" src=\"/zhong.js\"></script> \n" +
                "   <div id=\"ajaxloader\"></div> \n" +
                "   <div id=\"ajax-container\" style=\"position: relative;\"> \n" +
                "    <div class=\"model-hide\"> \n" +
                "     <div class=\"player\"> \n" +
                "      <div class=\"a1\">\n" +
                "        8-被睡走�望的丈夫拜�迫不得已�T惑其他男人 \n" +
                "      </div> \n" +
                "      <div class=\"player-background\"> \n" +
                "       <div class=\"video-js-box\"> \n" +
                "        <video id=\"video-js-id\" class=\"video-js\" width=\"100%\" height=\"100%\" controls=\"controls\" preload=\"auto\" poster=\"http://diaopic.97mimi.com/pic/uploadimg/2016-11/201611714432388616.jpg\"> \n" +
                "         <source class=\"src\" src=\"https://201606mp4.11bubu.com/20161107/tem-036/1/xml/91_5a8cbd003f8d4304df7b3974a6d61219.mp4\" type=\"video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;\"> HTML5 not supported \n" +
                "         <a href=\"https://201606mp4.11bubu.com/20161107/tem-036/1/xml/91_5a8cbd003f8d4304df7b3974a6d61219.mp4\">Download video</a>. \n" +
                "        </video> \n" +
                "       </div> \n" +
                "      </div> \n" +
                "     </div> \n" +
                "     <script type=\"text/javascript\" src=\"http://asd.994pao.com/99ads/dizhi.js\"></script> \n" +
                "    </div> \n" +
                "   </div> \n" +
                "   <div class=\"json-container hdn\"> \n" +
                "    <div id=\"center_overlay\"></div> \n" +
                "    <div id=\"sugg_container\"> \n" +
                "     <script type=\"text/javascript\" src=\"/js/azios.js\"></script> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2018-12/39881.html\" title=\"“要我要大鸡巴”对白激情淫荡猛男小旅店约炮独居寡妇风骚成熟寂寞美少妇奶子硕大饥渴淫叫猛摇连续高潮\" class=\"async\"><img alt=\"“要我要大鸡巴”对白激情淫荡猛男小旅店约炮独居寡妇风骚成熟寂寞美少妇奶子硕大饥渴淫叫猛摇连续高潮\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2018-12/201812271522678778.jpg\"><span class=\"time\">12-27</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2018-12/39881.html\" title=\"“要我要大鸡巴”对白激情淫荡猛男小旅店约炮独居寡妇风骚成熟寂寞美少妇奶子硕大饥渴淫叫猛摇连续高潮\" class=\"async\">“要我要大鸡巴”对白激情淫荡猛男小旅店约炮独居寡妇风骚成熟寂寞美少妇..</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2018-12/39878.html\" title=\"富家公子哥私人公寓约啪高颜值艺校苗条气质美女女警制服诱惑乳房白嫩饱满沙发床上疯狂输出\" class=\"async\"><img alt=\"富家公子哥私人公寓约啪高颜值艺校苗条气质美女女警制服诱惑乳房白嫩饱满沙发床上疯狂输出\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2018-12/201812271503780820.jpg\"><span class=\"time\">12-27</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2018-12/39878.html\" title=\"富家公子哥私人公寓约啪高颜值艺校苗条气质美女女警制服诱惑乳房白嫩饱满沙发床上疯狂输出\" class=\"async\">富家公子哥私人公寓约啪高颜值艺校苗条气质美女女警制服诱惑乳房白嫩饱满..</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <script type=\"text/javascript\" src=\"http://wxjr.hk637.com/cp.js\"></script> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2018-12/39874.html\" title=\"快餐达人城郊路边店找快活泄泄火碰到个气质成熟大波姐姐有点矜持放不开貌似刚做不久被使劲给干了国语对白\" class=\"async\"><img alt=\"快餐达人城郊路边店找快活泄泄火碰到个气质成熟大波姐姐有点矜持放不开貌似刚做不久被使劲给干了国语对白\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2018-12/2018122714582091948.jpg\"><span class=\"time\">12-27</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2018-12/39874.html\" title=\"快餐达人城郊路边店找快活泄泄火碰到个气质成熟大波姐姐有点矜持放不开貌似刚做不久被使劲给干了国语对白\" class=\"async\">快餐达人城郊路边店找快活泄泄火碰到个气质成熟大波姐姐有点矜持放不开貌..</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2018-12/39868.html\" title=\"征服美少妇激情口交 各种姿势猛草\" class=\"async\"><img alt=\"征服美少妇激情口交 各种姿势猛草\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2018-12/2018122714543171004.jpg\"><span class=\"time\">12-27</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2018-12/39868.html\" title=\"征服美少妇激情口交 各种姿势猛草\" class=\"async\">征服美少妇激情口交 各种姿势猛草</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <div class=\"a1\"> \n" +
                "      <a href=\"\" title=\"随机推荐视频\" class=\"async\">随机推荐视频</a> \n" +
                "     </div>\n" +
                "     <script type=\"text/javascript\" src=\"/js/dibu1.js\"></script> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2016-5/11922.html\" title=\"4-要是高潮了妻子就要被��面中出！！[中文字幕]\" class=\"async\"><img alt=\"4-要是高潮了妻子就要被��面中出！！[中文字幕]\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2016-5/201652510232928484.jpg\"><span class=\"time\">05-25</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2016-5/11922.html\" title=\"4-要是高潮了妻子就要被��面中出！！[中文字幕]\" class=\"async\">4-要是高潮了妻子就要被��面中出！！[中文字幕]</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2016-5/11707.html\" title=\"2-在��地的同�W���e和��人妻的同�W��玩超色的��王�[�颍。� 2[中文字幕]\" class=\"async\"><img alt=\"2-在��地的同�W���e和��人妻的同�W��玩超色的��王�[�颍。� 2[中文字幕]\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2016-5/20165215503587681.jpg\"><span class=\"time\">05-21</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2016-5/11707.html\" title=\"2-在��地的同�W���e和��人妻的同�W��玩超色的��王�[�颍。� 2[中文字幕]\" class=\"async\">2-在��地的同�W���e和��人妻的同�W��玩超色的��王�[�颍。� 2[中文字..</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <script type=\"text/javascript\" src=\"http://wxjr.hk637.com/cp.js\"></script> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2016-5/11834.html\" title=\"5-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]\" class=\"async\"><img alt=\"5-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2016-5/2016523635789639.jpg\"><span class=\"time\">05-23</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2016-5/11834.html\" title=\"5-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]\" class=\"async\">5-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <div class=\"video\"> \n" +
                "      <div class=\"shadow\"> \n" +
                "       <a href=\"/video/2016-5/11835.html\" title=\"6-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]\" class=\"async\"><img alt=\"6-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]\" src=\"http://diaopic.97mimi.com/pic/uploadimg/2016-5/201652364742127.jpg\"><span class=\"time\">05-23</span><span class=\"icons\"></span></a> \n" +
                "      </div> \n" +
                "      <p><a href=\"/video/2016-5/11835.html\" title=\"6-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]\" class=\"async\">6-趁老公不在�Z趴偷情人妻 服部圭子[中文字幕]</a></p> \n" +
                "      <span class=\"rating good\"><script type=\"text/javascript\" src=\"/k.js\"></script></span> \n" +
                "     </div> \n" +
                "     <script type=\"text/javascript\" src=\"/js/dibu.js\"></script>\n" +
                "    </div> \n" +
                "    <script type=\"text/javascript\">\n" +
                "       $(function(){\n" +
                "            $('#show-more').hide();\n" +
                "       });\n" +
                "    </script> \n" +
                "   </div> \n" +
                "   <div> \n" +
                "    <div class=\"footer\"> \n" +
                "     <p align=\"center\"><strong><font color=\"#DBDBDB\">35pao视频手机版 - 35pao</font></strong></p> \n" +
                "    </div> \n" +
                "    <script type=\"text/javascript\" src=\"/js/iso2.js\"></script> \n" +
                "    <div style=\"display:none\">\n" +
                "     <script type=\"text/javascript\" src=\"/js/tj.js\"></script>\n" +
                "    </div> \n" +
                "    <script type=\"text/javascript\" src=\"/js/foot.js\"></script>\n" +
                "   </div> \n" +
                "   <script>window._bd_share_config={\"common\":{\"bdSnsKey\":{},\"bdText\":\"\",\"bdMini\":\"2\",\"bdMiniList\":false,\"bdPic\":\"\",\"bdStyle\":\"0\",\"bdSize\":\"16\"},\"slide\":{\"type\":\"slide\",\"bdImg\":\"1\",\"bdPos\":\"right\",\"bdTop\":\"100\"},\"image\":{\"viewList\":[\"qzone\",\"tsina\",\"tqq\",\"renren\",\"weixin\"],\"viewText\":\"分享到：\",\"viewSize\":\"16\"},\"selectShare\":{\"bdContainerClass\":null,\"bdSelectMiniList\":[\"qzone\",\"tsina\",\"tqq\",\"renren\",\"weixin\"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> \n" +
                "  </div> \n" +
                "  <!--代码开始--> \n" +
                "  <script type=\"text/javascript\">\n" +
                "window.setInterval(show,5000); \n" +
                "var count=0;\n" +
                "function show()\n" +
                "{\n" +
                "\t$(\".scroll-image-wrapper li\").removeClass(\"current\");\n" +
                "\t$(\".scroll-image-wrapper li\").eq(count).addClass(\"current\");\n" +
                "\t$(\".scroll-title-wrapper li\").removeClass(\"current\");\n" +
                "\t$(\".scroll-title-wrapper li\").eq(count).addClass(\"current\");\n" +
                "\t$(\".scroll-title-wrapper li\").eq(count-1).animate({left:'-1000px'},300)\n" +
                "\t$(\".scroll-title-wrapper li\").attr(\"style\",\"left: 417px; display: none;\");\n" +
                "\t$(\".scroll-title-wrapper li\").eq(count).css(\"display\",\"block\");\n" +
                "\t$(\".scroll-title-wrapper li\").eq(count).animate({left:'0px'},300);\n" +
                "\t$(\".scroll-panel li\").removeClass(\"current\");\n" +
                "\t$(\".scroll-panel li\").eq(count).addClass(\"current\");\n" +
                "\tcount++;\n" +
                "\tif(count>3)\n" +
                "\t{\n" +
                "\t\tcount=0;\n" +
                "\t\t}\n" +
                "\t}\n" +
                "</script> \n" +
                "  <script type=\"text/javascript\" src=\"/dd.js\"></script> \n" +
                "  <script type=\"text/javascript\">\n" +
                "\t\t\t\t$(function(){\n" +
                "\t\t\t\t\t$(\".close-btn\").click(function(){\n" +
                "\t\t\t\t\t\t$(\".doc-footer-wrapper\").hide();\n" +
                "\t\t\t\t\t\t});\n" +
                "\t\t\t\t\t});\n" +
                "\t\t\t\t</script> \n" +
                "  <!--代码结束-->  \n" +
                "  <!-- /en/id/17483 -->  \n" +
                " </body>\n" +
                "</html>";
        Html html = new Html(s);
        String name = html.xpath("//div[@id=ajax-container]/div[@class=model-hide]/div[@class=player]/div[@class=a1]/text()").get();
        String movieUrl = html.xpath("//div[@id=ajax-container]/div[@class=model-hide]/div[@class=player]/div[@class=player-background]/div[@class=video-js-box]//a/@href").get();
//        /div[@class=video-js-box]/div[@id=video-js-id]/

    }
}
